<template>
  <uni-list>
    <template v-for="col in columns" :key="col.dataIndex">
      <uni-list-item class="listItem" :title="col.title" :note="col.note ? record[col.dataIndex] : ''">
        <template v-slot:footer>
          <!-- 如果定义了自定义渲染 -->
          <template v-if="col.scopedSlots">
            <view class="default-right">
              <slot :name="col.dataIndex" :text="record[col.dataIndex]" :record="record" :column="col" />
            </view>
          </template>

          <!-- 默认右侧展示 -->
          <template v-else-if="!col.note">
            <view class="default-right">
              {{ record[col.dataIndex] }}
            </view>
          </template>
        </template>
      </uni-list-item>
    </template>
  </uni-list>
</template>

<script setup>
defineProps({
  record: {
    type: Object,
    required: true
  },
  columns: {
    type: Array,
    required: true
  }
})
</script>

<style scoped lang="scss">
// .uni-list-item__content{
//   flex: none;
// }
.default-right {
  font-size: 14px;
  color: #999;
  // flex: 1;
}
</style>